<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : moviesTransform.xsl
    Created on : May 28, 2012, 5:18 PM
    Author     : Dusan
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xml:lang="en" version="1.0">
    <xsl:output method="html" encoding="UTF-8"/>
    
    <xsl:template match="/">
        <xsl:choose>
            <xsl:when test="count(//medium) = 1">
                <xsl:apply-templates />
            </xsl:when>            
        </xsl:choose>
    </xsl:template>
    
    <xsl:template match="medium">        
            <xsl:for-each select="movies/movie">
                <tr>
                    <td> <xsl:value-of select="/medium/name" /></td>
                    <td> <xsl:value-of select="title" /> </td>
                    <td> <xsl:value-of select="length" /> </td>
                    <td> <xsl:value-of select="languages" /> </td>
                    <td> <xsl:value-of select="genre" /> </td>
                    <td> <xsl:value-of select="format" /> </td>
                    <td> <xsl:value-of select="note" /> </td>    
                </tr>
            </xsl:for-each>               
    </xsl:template>
</xsl:stylesheet>
